﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CUDLR
{
    /// <summary> 列出根目录 </summary>
    public class ListRoot
    {
        /// <summary> 设备名字 </summary>
        public string device_name;
        /// <summary> 设备uuid </summary>
        public string device_uuid;
        /// <summary> 文件 列表</summary>
        public RootItem[] files;
        /// <summary> 请求是否已完成 </summary>
        public bool hasDon;
    }

    /// <summary> 列出根目录  结构 </summary>
    [System.Serializable]
    public class RootItem
    {
        /// <summary> 是否有子文件夹 </summary>
        public bool has_children;
        /// <summary> 图标id   7f0200e6     7f0200e6</summary>
        public string icon_id;
        /// <summary> 显示名字 注释 </summary>
        public string label;
        /// <summary> 挂载点 </summary>
        public string mount;
        /// <summary> 文件名字  </summary>
        public string n;
        /// <summary> 剩余空间 byte </summary>
        public long space_free;
        /// <summary> 总空间  byte</summary>
        public long space_total;
        /// <summary> 文件类型 </summary>
        public EDirType t;
    }


    /// <summary> 列出文件</summary>
    [System.Serializable]
    public class ListFile
    {
        /// <summary> 列出的所有文件  </summary>
        public FileItem[] files;
        /// <summary> 请求是否已完成 </summary>
        public bool hasDon;
    }


    /// <summary> 列出文件</summary>
    [System.Serializable]
    public class DeleteFile
    {
        public long vol_free_space;
        public bool ok;
        /// <summary> 请求是否已完成 </summary>
        public bool hasDon = true;
    }

    /// <summary> 列出文件 </summary>
    [System.Serializable]
    public class FileItem
    {
        /// <summary> 文件名字 </summary>
        public string n;
        /// <summary> 是否是隐藏 </summary>
        public bool hidden;
        /// <summary> 文件大小 </summary>
        public long size;
        /// <summary> 创建时间 </summary>
        public long time;
        /// <summary> 是否有子文件夹 </summary>
        public bool has_children;
        /// <summary> 文件类型  文件夹1   文件 2</summary>
        public EDirType t;
    }

    /// <summary>
    /// 文件图标
    /// </summary>
    public class FileIcon
    {
        /// <summary> 文件名字 </summary>
        public string fileName { get; private set; }

        /// <summary> 文件数据  </summary>
        public byte[] bytes;

        public FileIcon(string fileName)
        {
            this.fileName = fileName;
        }
    }
    
    /// <summary>
    /// 文件重定向
    /// </summary>
    public class PathRedirect
    {
        /// <summary> 请求的路径 </summary>
        public string reqPath { get; private set; }
        /// <summary> 真实文件路径 </summary>
        public string realPath { get; private set; }
        /// <summary> 是否在主线程调用 </summary>
        public bool mainThread;
        public PathRedirect(string reqPath, string realPath)
        {
            this.reqPath = reqPath;
            this.realPath = realPath;
        }
    }

    /// <summary>
    /// 目录类型
    /// </summary>
    public enum EDirType
    {
        /// <summary> 驱动器 </summary>
        Driver = 0,
        /// <summary> 文件夹 </summary>
        Floder = 1,
        /// <summary> 文件 </summary>
        File = 2,
    }
}
